package game;

import util.Vector2D;
import entities.Entity;

public class Collision<T extends Entity> {

	private final Entity entity;
	private final T collidingEntity;
	private final boolean colliding;

	/**
	 * A generic class that represents a collision between two entities.
	 * @param entity first entity
	 * @param collidingEntity second entity
	 * @param colliding whether the two entities are colliding or not
	 */
	public Collision(Entity entity, T collidingEntity, boolean colliding) {
		this.entity = entity;
		this.collidingEntity = collidingEntity;
		this.colliding = colliding;
	}

	public Entity getEntity() {
		return entity;
	}

	public T getColldingEntity() {
		return collidingEntity;
	}

	public boolean isCollision() {
		return colliding;
	}

	/**
	 * Gives the distance between the two Entities, using {@link #entity} as
	 * reference
	 * 
	 * @return
	 */
	public Vector2D getEntityDistance() {
		return collidingEntity.getPosition().subtract(entity.getPosition());
	}
}
